// SpecDefObjectFactoryVersionOne.cpp: implementation of the SpecDefObjectFactoryVersionOne class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SpecDefObjectFactoryVersionOne.h"
#include "SpecDefVersionOne.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

namespace Specification
{
	SpecDefObjectFactoryVersionOne::SpecDefObjectFactoryVersionOne()
	{
		
	}
	
	SpecDefObjectFactoryVersionOne::~SpecDefObjectFactoryVersionOne()
	{
		
	}
	
	SpecDefPtr SpecDefObjectFactoryVersionOne::NewObject(typeSpecDefItem& item)
	{
		if (item->IsEmpty())
		{
			return NULL;		
		}
		SpecDefPtr SpecDef(new SpecDefVersionOne);		
		try
		{
			SpecDef->SetCallingKey(item->GetString(_T("CallingKey")));
			SpecDef->SetGradeKey(item->GetString(_T("SetGradeKey")));
			SpecDef->SetSpecName(item->GetString(_T("SpecName")));
			SpecDef->SetSpecKey(item->GetString(_T("SpecKey")));
		}
		catch (UEException *e) 
		{
			e->ReportError();
			e->Delete();
			ASSERT(FALSE);
			return NULL;
		}
		return SpecDef;
	}
}

